# -*- encoding:utf-8 -*-
# @Time : 2025/3/13 13:49
# @Author : xunter
# @Email : 3133739348@qq.com
# @File : ModelMixin.py
# @Software : PyCharm
from django.db import models


class DataTimeModelMixin(models.Model):
    create_time = models.DateTimeField(auto_now_add=True)
    update_time = models.DateTimeField(auto_now=True)
    class Meta:
        abstract = True

class IsDeleteModelMixin(models.Model):
    is_delete = models.BooleanField(verbose_name='逻辑删除', default=False)

    class Meta:
        abstract = True

    def delete(self, using=None, keep_parents=False):
        self.is_delete = True
        self.save()

class ModelSetMixin(DataTimeModelMixin,IsDeleteModelMixin):
    class Meta:
        abstract = True